<!DOCTYPE html>
<html>

<head>
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
	<meta charset="UTF-8" />
	<title>Add Omi in One Minute</title>
</head>

<body>
	<script src="https://tencent.github.io/omi/packages/omi/dist/omi.min.js"></script>
	<script>
		const { WeElement, h, render, define } = Omi

		define('like-button',
			class extends WeElement {
				install() {
					this.data = { liked: false }
				}

				render() {
					if (this.data.liked) {
						return 'You liked this.'
					}

					return h(
						'button',
						{
							onClick: () => {
								this.data.liked = true
								this.update()
              }
						},
						'Like'
					)
				}
			})

		render(h('like-button'), 'body')
	</script>

	<a href="https://github.com/Tencent/omi" target="_blank" style="position: fixed; right: 0; top: 0; z-index: 3;">
		<img src="//alloyteam.github.io/github.png" alt="">
	</a>
</body>

</html>
